import java.util.*;
class Stu{
     String _name;
     int _Chinese;
     int _English;
     int _Math;
     double avge;

    public Stu(String name,int Chinese,int English,int Math) {
        _name = name;
        _Chinese = Chinese;
        _English = English;
        _Math = Math;
        avge = 1.0*(_Chinese+_English+_Math)/3;
    }

    public double getAvge() {
        return avge;
    }
    public String getName() {
        return _name;
    }
    public int getChinese() {
        return _Chinese;
    }
    public int getEnglish() {
        return _English;
    }
    public int getMath() {
        return _Math;
    }
}

public class Main5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Stu arr[] = new Stu[n];
        for(int i =0;i<n;i++) {
            String name = sc.next();
            int Chinese = sc.nextInt();
            int English = sc.nextInt();
            int Math = sc.nextInt();

            arr[i] = new Stu(name,Chinese,English,Math);
        }

        for(int i =n-1;i>=0;i--) {
            if(arr[i].getAvge()>=60)
            {
                System.out.print(arr[i].getName()+" "+arr[i].getChinese()+" "+arr[i].getEnglish()+" "+arr[i].getMath());
                System.out.printf(" %.2f\n",arr[i].getAvge());
            }
        }
        sc.close();
    }
}
